package com.student.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.student.pojo.Ke;
import com.student.service.KeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * @author 是一个鸽子啊
 * @date 2020/4/14
 * @qq 364826415
 */
@RestController
public class KeAjaxController {
    @Autowired
    @Qualifier("KeServiceImpl")
    private KeService keService;
    @RequestMapping("/queryKeByID")
    private String queryKeByID(String keID) throws JsonProcessingException {
        Ke ke = keService.queryKeByID(Integer.parseInt(keID));
        ObjectMapper objectMapper = new ObjectMapper();
        String val = objectMapper.writeValueAsString(ke);
        return val;

    }
}
